Skip to content

feat(cli): add update-models command#3739

Open
panoskava wants to merge 12 commits intocode-yeongyu:devfrom
panoskava:feat/update-models-command
Open

feat(cli): add update-models command#3739
panoskava wants to merge 12 commits intocode-yeongyu:devfrom
panoskava:feat/update-models-command

Conversation

@panoskava
Copy link
Copy Markdown

@panoskava panoskava commented Apr 30, 2026

Summary

Add update-models CLI command to update model mappings with latest plugin recommendations. This command allows users to automatically synchronize their local model configurations with the latest recommended model mappings from the plugin.

  • Fetches latest model mappings from plugin recommendations
  • Compares with local configuration and shows diff
  • Backs up existing configuration before making changes
  • Updates model mappings atomically

Changes

Added Files

  • src/cli/update-models/index.ts - Main entry point for update-models command
  • src/cli/update-models/update-models.ts - Core implementation with config loading, detection, and generation
  • src/cli/update-models/types.ts - Type definitions for model mappings and configuration
  • src/cli/update-models/compare-mappings.ts - Utility to compare and diff model mappings
  • src/cli/update-models/compare-mappings.test.ts - Unit tests for comparison logic
  • src/cli/update-models.test.ts - Comprehensive test suite for the command

Modified Files

  • src/cli/cli-program.ts - Registered the new update-models command in the CLI program

Testing

# Run the type checker
bun run typecheck

# Run tests for the update-models command
bun test src/cli/update-models.test.ts

# Run tests for comparison utilities
bun test src/cli/update-models/compare-mappings.test.ts

# Test the CLI command manually
bun run build
./bin/omo update-models --help
./bin/omo update-models --dry-run

Related Issues

Closes #3662


View in Codesmith
Need help on this PR? Tag @codesmith with what you need.

  • Let Codesmith autofix CI failures and bot reviews

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 30, 2026

All contributors have signed the CLA. Thank you! ✅
Posted by the CLA Assistant Lite bot.

@panoskava
Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

github-actions Bot added a commit that referenced this pull request Apr 30, 2026
@panoskava panoskava marked this pull request as draft April 30, 2026 18:55
@panoskava panoskava marked this pull request as ready for review May 1, 2026 09:38
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 7 files

Confidence score: 3/5

  • There is a concrete behavior risk in src/cli/update-models/update-models.ts: provider detection ignores options.directory, so running with --directory may build mappings from the wrong project.
  • Because this issue is severity 6/10 with high confidence (8/10) and is user-facing CLI behavior, this sits in moderate merge risk rather than a minor housekeeping concern.
  • Pay close attention to src/cli/update-models/update-models.ts - ensure provider detection resolves paths from the user-supplied directory to avoid cross-project mapping mistakes.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="src/cli/update-models/update-models.ts">

<violation number="1" location="src/cli/update-models/update-models.ts:56">
P2: Provider detection ignores `options.directory`, so `--directory` can generate mappings from the wrong project.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Comment thread src/cli/update-models/update-models.ts Outdated
When --directory option is passed to update-models, the provider detection
now correctly uses the specified project directory instead of always
using the current working directory.

- Add optional directory parameter to detectCurrentConfig()
- Add directory parameter to detectConfigFormat() for opencode.json detection
- Pass directory to detectProvidersFromOmoConfig() for omo config detection
- Update update-models.ts to pass directory to detect()

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0 issues found across 3 files (changes from recent commits).

Requires human review: Large PR modifies core config detection logic. Detected type inconsistency in UpdateModelsDeps interface and potential path confusion for project-level vs global configurations.

…--json

Previously, running 'update-models --dry-run' without --json produced no
console output despite returning successfully. Now it prints the human-readable
dry-run message like 'Dry run: X entries would be updated, Y preserved, Z added'.
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0 issues found across 1 file (changes from recent commits).

Requires human review: Potential ReferenceError: loadExistingConfig is not defined in update-models.ts. Inconsistent config paths between new command and detection logic in detect-current-config.ts.

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 1 file (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="src/cli/config-manager/detect-current-config.ts">

<violation number="1" location="src/cli/config-manager/detect-current-config.ts:18">
P1: Custom agent: **Opencode Compatibility**

Project config path was changed away from the canonical `.opencode/` location, so existing Opencode configs will not be detected.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
Try running cubic reviews locally in CLI to avoid back-and-forth.

Comment thread src/cli/config-manager/detect-current-config.ts Outdated
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Plugin and Agent Update Tool

1 participant